JSON Response {"d":"128.00"} but displaying "128"
Posted
by TGuimond
on Stack Overflow
See other posts from Stack Overflow
or by TGuimond
Published on 2010-04-15T16:46:04Z
Indexed on
2010/04/15
17:03 UTC
Read the original article
Hit count: 177
Hi all,
I have been working on a shopping cart that the user can add/remove order items as they please and am returning an updated sub-total via a webservice using jQuery $.ajax
Here is how I am calling the webservice and setting the sub-total with the response.
//perform the ajax call
$.ajax({
url: p,
data: '{' + s + '}',
success: function(sTotal) {
//order was updated: set span to new sub-total
$("#cartRow" + orderID).find(".subTotal").text(sTotal);
},
failure: function() {
//if the orer was not saved
//console.log('Error: Order not deleted');
}
});
The response I am getting seems perfectly fine:
{"d":"128.00"}
When I display the total on the page it displays as 128 rather than 128.00
I am fully sure it is something very simple and silly but I am so deep into it now I need someone with a fresh brain to help me out!!
Cheers :)
© Stack Overflow or respective owner